package de.greenrobot.daoexample.model;

import com.banciyuan.bcywebview.biz.detail.adapter.DetailConstants;

/**
 * Created by hfxt2008 on 14-12-11.
 * <p/>
 * Detail中图片item的信息类
 */
public class DetailImageData extends DetailData {

    //加载失败
    public static final int DOWNLOAD_ERROR = -1;
    //加载还没开始
    public static final int DOWNLOAD_UNSTART = 1;
    //加载中
    public static final int DOWNLOAD_ING = 10;
    //加载完成
    public static final int DOWNLOAD_COMPLETE = 11;

    //图片在showlist中的哪个位置
    private int location = 0;
    //图片处在加载的哪个阶段
    private int status = DOWNLOAD_UNSTART;

    //网络图片的网络地址，detail中全部都是网络图片，所以url不可能为空
    private String url;

    //图片具体在sd卡上的存储地址
    private String mFilePath;

    private boolean if_size;

    private boolean is_padding = true;

    private int sub_index;

    private boolean is_large;

    private String orgin_url;

    private int top;

    private int left;

    private String type;

    //图片的长宽
    private int width = 1000;
    private int height = 1000;

    public DetailImageData(String url) {
        this.url = url;
        this.dataType = DetailConstants.IMAGE_TYPE;
    }

    public int getLocation() {
        return location;
    }

    public void setLocation(int location) {
        this.location = location;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUrl() {
        return url;
    }

    public int getStatus() {
        switch (status) {
            case DOWNLOAD_ERROR:
            case DOWNLOAD_UNSTART:
            case DOWNLOAD_ING:
            case DOWNLOAD_COMPLETE:
                return status;
            default:
                status = DOWNLOAD_UNSTART;
                return status;
        }
    }

    public void onLoadingError() {
        this.status = DOWNLOAD_ERROR;
    }

    public void onLoading() {
        this.status = DOWNLOAD_ING;
    }

    public void onLoadingComplete() {
        this.status = DOWNLOAD_COMPLETE;
    }

    public void beforeLoading() {
        this.status = DOWNLOAD_UNSTART;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public void setHeight(int height) {
        this.height = height;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getmFilePath() {
        if (null == mFilePath) mFilePath = "";
        return mFilePath;
    }

    public void setmFilePath(String mFilePath) {
        if (null != mFilePath) this.mFilePath = mFilePath;
    }

    public boolean isIf_size() {
        return if_size;
    }

    public void setIf_size(boolean if_size) {
        this.if_size = if_size;
    }

    public boolean is_padding() {
        return is_padding;
    }

    public void setIs_padding(boolean is_padding) {
        this.is_padding = is_padding;
    }

    public int getSub_index() {
        return sub_index;
    }

    public void setSub_index(int sub_index) {
        this.sub_index = sub_index;
    }

    public boolean is_large() {
        return is_large;
    }

    public void setIs_large(boolean is_large) {
        this.is_large = is_large;
    }

    public String getOrgin_url() {
        return orgin_url;
    }

    public void setOrgin_url(String orgin_url) {
        this.orgin_url = orgin_url;
    }

    public int getTop() {
        return top;
    }

    public int getLeft() {
        return left;
    }

    public void setTop(int top) {
        this.top = top;
    }

    public void setLeft(int left) {
        this.left = left;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}